﻿
using System;
using System.Collections.Generic;
using jcs.Core.SSManager;
using NUnit.Framework;

namespace jcs.Dat.SSManager.Tests
{
    [TestFixture]
    public class SnapshotProviderTests
    {
        private const string LogicalFileName = "SnapshotTestDatabase";
        private const string FilePath = @"C:\Source\zzCodePlex\SQLSnapshotManager\Tests\UnitTestDatabase\";
        private const string Extension = "_snap";
        private readonly DateTime _creationTime = DateTime.Now;

        [Test]
        public void BbGetExistingSnapshotsTests()
        {
            var snapshots = SnapshotProvider.GetExistingSnapshots(Extension);
            Assert.AreNotEqual(null, snapshots);
            Assert.AreNotEqual(string.Empty, snapshots[0].LogicalFileName);
            Assert.AreNotEqual(String.Empty, snapshots[0].SnapshotName);
        }

        [Test]
        public void AaCreateNewSnapshotTests() 
        {

            var snapShot = Factory.GetSnapshot(LogicalFileName + Extension, LogicalFileName, FilePath, Extension, _creationTime);
            Assert.AreEqual(true, SnapshotProvider.CreateSnapshot(snapShot));

        }

        [Test]
        public void CcDeleteSnapshotsTests()
        {
            var names = new List<string> { LogicalFileName };
            Assert.AreEqual(true, SnapshotProvider.DeleteSnapshots(names, Extension));
        }

    }
}
